package com.hyt.it.ogt.controller.ykcj.grade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.annotation.Log;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.enums.BusinessType;
import com.hyt.it.ogt.ykcj.common.utils.poi.ExcelUtil;
import com.hyt.it.ogt.ykcj.domain.vo.ExportParamVo;
import com.hyt.it.ogt.ykcj.domain.vo.GradeAnalysisRsp;
import com.hyt.it.ogt.ykcj.domain.vo.QueryExamineeGradeVo;
import com.hyt.it.ogt.ykcj.domain.vo.export.ExportAreaAnalysisDataVo;
import com.hyt.it.ogt.ykcj.service.grade.IGradeAnalysisDataService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;

/**
 * 考试成绩数据分析Controller
 * 
 * @author admin
 * @date 2021-06-24
 */
@Api(tags = "grade.2.考试成绩数据分析", value = "考试成绩数据分析请求接口")
@ApiSort(value = 202)
@RestController
@RequestMapping("/grade/analysis")
public class GradeAnalysisDataController extends BaseController {
    @Autowired
    private IGradeAnalysisDataService gradeAnalysisDataService;

    /**
     * 查询考试成绩数据分析列表
     */
    @ApiOperation("查询考试成绩数据分析列表")
    @GetMapping("/queryAnalysisData")
    public AjaxResult queryAnalysisData(QueryExamineeGradeVo queryExamineeGradeVo) {
        GradeAnalysisRsp rsp = gradeAnalysisDataService.selectGradeAnalysisData(queryExamineeGradeVo);
        return AjaxResult.success(rsp);
    }

    /**
     * 导出考试成绩区域数据分析列表
     */
    @ApiOperation("导出考试成绩区域数据分析列表")
    @Log(title = "导出地区考试成绩分析数据", businessType = BusinessType.EXPORT)
    @PostMapping("/exportAreaAnalysisData")
    public AjaxResult exportAreaAnalysisData(@RequestBody ExportParamVo exportParamVo) {
        List<ExportAreaAnalysisDataVo> list = gradeAnalysisDataService.selectExportAreaDataList(exportParamVo);
        ExcelUtil<ExportAreaAnalysisDataVo> util = new ExcelUtil<ExportAreaAnalysisDataVo>(ExportAreaAnalysisDataVo.class);
        return util.exportExcel(list, "考试成绩数据分析数据");
    }

    /**
     * 导出考试成绩区域数据分析列表
     */
    @ApiOperation("导出考试成绩区域数据分析列表")
    @Log(title = "导出考试成绩统计分析数据", businessType = BusinessType.EXPORT)
    @PostMapping("/exportAnalysisData")
    public AjaxResult exportAnalysisData(@RequestBody ExportParamVo exportParamVo) {

        return gradeAnalysisDataService.exportAnalysisData(exportParamVo);
    }

}
